package com.nlx.notes.module.controller.user;

import com.nlx.notes.module.bean.vo.user.UserBaseInfoVO;
import com.nlx.notes.module.service.user.UserViewService;
import com.nlx.notes.support.context.UserHolder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/user")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class UserViewController {

    final UserViewService userViewService;

    @GetMapping(value = "info/v1")
    public UserBaseInfoVO userInfo(){
        log.info("获取当前用户的基本信息 -> {}", UserHolder.getUserContext().getUserPhone());
        return userViewService.userInfo(UserHolder.getUserContext().getId());
    }

}
